<?php

/**
 * tblHotel filter form base class.
 *
 * @package    travis
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BasetblHotelFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'name_en'        => new sfWidgetFormFilterInput(),
      'name_he'        => new sfWidgetFormFilterInput(),
      'name_ru'        => new sfWidgetFormFilterInput(),
      'provider_id'    => new sfWidgetFormFilterInput(),
      'provider_code'  => new sfWidgetFormFilterInput(),
      'country_id'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('CountryHotel'), 'add_empty' => true)),
      'region_id'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('RegionHotel'), 'add_empty' => true)),
      'city_id'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('CityHotel'), 'add_empty' => true)),
      'stars'          => new sfWidgetFormFilterInput(),
      'address'        => new sfWidgetFormFilterInput(),
      'phone1'         => new sfWidgetFormFilterInput(),
      'phone2'         => new sfWidgetFormFilterInput(),
      'fax'            => new sfWidgetFormFilterInput(),
      'email'          => new sfWidgetFormFilterInput(),
      'web_site'       => new sfWidgetFormFilterInput(),
      'description_en' => new sfWidgetFormFilterInput(),
      'description_ru' => new sfWidgetFormFilterInput(),
      'description_he' => new sfWidgetFormFilterInput(),
      'reputation'     => new sfWidgetFormFilterInput(),
      'latitude'       => new sfWidgetFormFilterInput(),
      'longitude'      => new sfWidgetFormFilterInput(),
      'photo'          => new sfWidgetFormFilterInput(),
      'priority'       => new sfWidgetFormFilterInput(),
      'update_time'    => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'create_time'    => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
    ));

    $this->setValidators(array(
      'name_en'        => new sfValidatorPass(array('required' => false)),
      'name_he'        => new sfValidatorPass(array('required' => false)),
      'name_ru'        => new sfValidatorPass(array('required' => false)),
      'provider_id'    => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'provider_code'  => new sfValidatorPass(array('required' => false)),
      'country_id'     => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('CountryHotel'), 'column' => 'id')),
      'region_id'      => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('RegionHotel'), 'column' => 'id')),
      'city_id'        => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('CityHotel'), 'column' => 'id')),
      'stars'          => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'address'        => new sfValidatorPass(array('required' => false)),
      'phone1'         => new sfValidatorPass(array('required' => false)),
      'phone2'         => new sfValidatorPass(array('required' => false)),
      'fax'            => new sfValidatorPass(array('required' => false)),
      'email'          => new sfValidatorPass(array('required' => false)),
      'web_site'       => new sfValidatorPass(array('required' => false)),
      'description_en' => new sfValidatorPass(array('required' => false)),
      'description_ru' => new sfValidatorPass(array('required' => false)),
      'description_he' => new sfValidatorPass(array('required' => false)),
      'reputation'     => new sfValidatorPass(array('required' => false)),
      'latitude'       => new sfValidatorPass(array('required' => false)),
      'longitude'      => new sfValidatorPass(array('required' => false)),
      'photo'          => new sfValidatorPass(array('required' => false)),
      'priority'       => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'update_time'    => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'create_time'    => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
    ));

    $this->widgetSchema->setNameFormat('tbl_hotel_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'tblHotel';
  }

  public function getFields()
  {
    return array(
      'id'             => 'Number',
      'name_en'        => 'Text',
      'name_he'        => 'Text',
      'name_ru'        => 'Text',
      'provider_id'    => 'Number',
      'provider_code'  => 'Text',
      'country_id'     => 'ForeignKey',
      'region_id'      => 'ForeignKey',
      'city_id'        => 'ForeignKey',
      'stars'          => 'Number',
      'address'        => 'Text',
      'phone1'         => 'Text',
      'phone2'         => 'Text',
      'fax'            => 'Text',
      'email'          => 'Text',
      'web_site'       => 'Text',
      'description_en' => 'Text',
      'description_ru' => 'Text',
      'description_he' => 'Text',
      'reputation'     => 'Text',
      'latitude'       => 'Text',
      'longitude'      => 'Text',
      'photo'          => 'Text',
      'priority'       => 'Number',
      'update_time'    => 'Date',
      'create_time'    => 'Date',
    );
  }
}
